import { ref, render, defineComponent, onBeforeUnmount, h, createVNode } from "vue";
import withInstall from "../../utils/withInstall.mjs";
import "./delete-tips.vue.mjs";
import "./delete-api-tips.vue.mjs";
import _sfc_main from "./delete-tips.vue2.mjs";
import _sfc_main$1 from "./delete-api-tips.vue2.mjs";
const DeleteTips = withInstall(_sfc_main);
const visible = ref(false);
let isDestroyed = false;
const destory = (container) => {
  setTimeout(() => {
    var _a;
    render(null, container);
    container && ((_a = container.parentNode) == null ? void 0 : _a.removeChild(container));
    isDestroyed = true;
  }, 350);
};
DeleteTips.createInstance = (options) => {
  const container = document.createElement("div");
  visible.value = true;
  isDestroyed = false;
  document.body.appendChild(container);
  const DeleteTipsWrapper = defineComponent({
    name: "DeleteTipsWrapper",
    setup() {
      onBeforeUnmount(() => {
        visible.value = false;
        if (!isDestroyed) {
          destory(container);
        }
      });
      return () => {
        return h(_sfc_main$1, {
          ...options,
          show: visible.value,
          onOk() {
            options.onOk && options.onOk();
            destory(container);
            visible.value = false;
          },
          onCancel() {
            options.onCancel && options.onCancel();
            visible.value = false;
            destory(container);
          }
        });
      };
    }
  });
  const vm = createVNode(DeleteTipsWrapper);
  render(vm, container);
};
const deleteTips = {
  tips(options) {
    DeleteTips.createInstance(options);
  }
};
export {
  DeleteTips,
  deleteTips
};
//# sourceMappingURL=index.mjs.map
